<!doctype html>
<html class="no-js fixed-layout">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>首页</title>
  <meta name="description" content="index">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="/static/assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="/static/assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="/static/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="/static/assets/css/admin.css">
  <style type="text/css">
    .input_width{
      width: 200px;
    }
  </style>
</head>
<body>



  <div class="admin-content">
    <div class="admin-content-body">

      <div class="am-g">


 
        <div class="am-u-sm-12 am-u-md-12 ">
          <!--中间侧块 注意下面是form表-->
          
          <div class="am-form-group">
            <div class="am-g am-margin-top am-form-group">
              <div class="am-u-sm-5 am-u-md-6 am-text-right">桥梁名称：</div>
              <div class="am-u-sm-7 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <select  id='bridge_id' name='bridge_id' class="input_width" data-am-selected="{searchBox: 1}" onchange="bridge_change()" required="">
                  {% for i in bridgeInfo %}
                  {% if i.bridge_id == checkRecordInfo.bridge_id %}
                  <option value={{ i.bridge_id }} selected="selected">{{ i.bridge_name }}</option> 
                  {% else %}
                  <option value={{ i.bridge_id }} >{{ i.bridge_name }}</option> 
                  {% endif %}
                  {% endfor %}
                </select>
                
              </div>

            </div>

            <hr/>
            <div class="am-g am-margin-top am-form-group">
              <div class="am-u-sm-5 am-u-md-6 am-text-right">部件名称：</div>
              <div class="am-u-sm-7 am-u-md-4 am-u-end" style="padding-left: 0px;">
                
                <select  id='parts_code' name='parts_code' class="input_width" data-am-selected="{searchBox: 1}" onchange="parts_change()">
                  {% for i in partsInfo %}
                  {% if i.parts_code == checkRecordInfo.parts_code %}
                  <option value={{ i.parts_code }} selected="selected">{{ i.parts_name }}</option> 
                  {% else %}
                  <option value={{ i.parts_code }} >{{ i.parts_name }}</option> 
                  {% endif %}
                  {% endfor %}
                </select>
              </div>

            </div>
            <hr/>
            <div class="am-g am-margin-top am-form-group" id="bridge_csbm" >
              <div class="am-u-sm-5 am-u-md-6 am-text-right">构件名称：</div>
              <div class="am-u-sm-7 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <select  id='bridge_member' name='bridge_member' class="input_width" data-am-selected="{searchBox: 1}" onchange="member_change()">
                  {% for i in memberInfo %}
                  {% if i.bridge_member_id == checkRecordInfo.member_id %}
                  <option value={{ i.bridge_member_id }} selected="selected" attr1="{{ i.member_no }}">{{ i.member_name }}</option> 
                  {% else %}
                  <option value={{ i.bridge_member_id }} attr1="{{ i.member_no }}">{{ i.member_name }}</option>
                  {% endif %}
                  {% endfor %}
                </select>
              </div>

            </div>
            <hr/>
            <div class="am-g am-margin-top am-form-group" id="bridge_csbm" >
              <div class="am-u-sm-5 am-u-md-6 am-text-right">构件编号：</div>
              <div class="am-u-sm-7 am-u-md-4 am-u-end" style="padding-left: 0px;">
                <div id="member_name">{{ checkRecordInfo.member_no }}</div>
              </div>

            </div>
            <hr/>
            
          </div>
          
        </div>
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs" style="padding: 0 280px;">

              <button type="button" class="am-btn am-btn-primary am-btn-xs" onclick="add_submit({{ checkRecordId }})">移动</button>


            </div>
          </div>
        </div>

      </div>
    </div>

  </div>



<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/static/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="/static/assets/js/amazeui.min.js"></script>
<script src="/static/assets/js/amazeui.tree.js"></script>
<script src="/static/assets/datatables/amazeui.datatables.min.js"></script>
<script src="/static/assets/dialog/amazeui.dialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/assets/css/amazeui.tree.css" />
<script src="/static/assets/js/app.js"></script>
<script type="text/javascript">

$(document).ready(function(){
  var date = new Date();
    var seperator1 = "-";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
   
  $("#checkdate").attr('value',currentdate); 
})
 

function add_submit(check_record_id){
  var bridge_id = $("#bridge_id option:selected").val();
  var member_id = $("#bridge_member option:selected").val();


 
  if(bridge_id == '' || bridge_id == undefined){
    AlertMSG("请选择桥梁！")
  }else if(member_id=='' || member_id == undefined){
    AlertMSG("请选择责构件名称！")
  }else {
    $.ajax({
      "url":"/QLXJ_XJYW_JCJC_DISEASE_MOVESAVE/?check_record_id="+check_record_id+"&bridge_id="+bridge_id+"&member_id="+member_id+"",
      "datatype":"json",
      "type":"get",
      "async":"false"
      }).success(function(data){
        if (data.status == 1) {
          var index = parent.layer.getFrameIndex(window.name);
          parent.location.reload();
          parent.layer.close(index);


        } else {
          AlertMSG(data.message)
        }
      }).error(function(data){
        AlertMSG("保存失败！")
      });
  }
}

function bridge_change(){
    var bridge_id = $("#bridge_id option:selected").val();
    $.ajax({
      "url":"/QLXJ_XJYW_DQJC_SEE_DATA_PARTS/?bridge_id="+bridge_id+"",
      "datatype":"json",
      "type":"get",
      "async":"false"
    }).success(function(data){
      if (data.status == 1) {
        $("#parts_code").empty();
        for(var i=0;i<data.data.length;i++){
          $('#parts_code').append('<option value='+data.data[i].parts_code+' >'+data.data[i].parts_name+'</option>');
        } 
      } else {
        AlertMSG(data.message)
      }
    }).error(function(data){
      AlertMSG("查询构件信息失败！")
    });
  }

function parts_change(){
    var parts_code = $("#parts_code option:selected").val();
    var bridge_id = $("#bridge_id option:selected").val();
    $.ajax({
      "url":"/QLXJ_XJYW_JCJC_SEE_DATA_MEMBER/?check_id=0&bridge_id="+bridge_id+"&parts_code="+parts_code+"",
      "datatype":"json",
      "type":"get",
      "async":"false"
    }).success(function(data){
      if (data.status == 1) {
        $("#bridge_member").empty();
        for(var i=0;i<data.data.length;i++){
          $('#bridge_member').append('<option value='+data.data[i].bridge_member_id+' attr1='+data.data[i].member_no+' >'+data.data[i].member_name+'</option>');
        } 
      } else {
        AlertMSG(data.message)
      }
    }).error(function(data){
      AlertMSG("查询构件信息失败！")
    });
}

  function member_change(){
    var member_number = $("#bridge_member option:selected").attr("attr1");
    $("#member_name").html(member_number);
  }

var AlertMSG=function(msg){
    AMUI.dialog.alert({ title: '错误提示', content: msg, onConfirm: function() { console.log('close'); } });
}
</script>
</body>

</html>